using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Bussiness.Interfaces;
using DataProvider;
using Bussiness.Exc;

namespace Bussiness
{
    public class NHAPDIEM_SUBProcess:INHAPDIEM_SUB
    {
        IDBManager idbManager = new DBManager(DataProviderE.SqlServer);

        DataTable INHAPDIEM_SUB.HocSinhTheoLop(string malop)
        {
            DataTable dtb;
            try
            {
                idbManager.CreateParameters(1);
                idbManager.AddParameters(0, "@malop", malop, ParameterDirection.Input);
                idbManager.Open();
                dtb = idbManager.ExecuteDataSet(CommandType.StoredProcedure, "spHOCSINHTHEOLOPXem").Tables[0];
            }
            catch (DatabaseExc e)
            {
                throw new BussinessExc(e.Message, e.ErrCodeUser, e.ErrCodeSQL);
            }
            catch (Exception e)
            {
                throw new BussinessExc("Bussiness. INHAPDIEM_SUB.HocSinhTheoLop(string malop)" + e.Message);
            }
            finally
            {
                idbManager.Dispose();
            }
            return dtb;
        }
        DataTable INHAPDIEM_SUB.MonTheoLop(string malop)
        {
            DataTable dtb;
            try
            {
                idbManager.CreateParameters(1);
                idbManager.AddParameters(0, "@malop", malop, ParameterDirection.Input);
                idbManager.Open();
                dtb = idbManager.ExecuteDataSet(CommandType.StoredProcedure, "spMONTHEOLOPXem").Tables[0];
            }
            catch (DatabaseExc e)
            {
                throw new BussinessExc(e.Message, e.ErrCodeUser, e.ErrCodeSQL);
            }
            catch (Exception e)
            {
                throw new BussinessExc("Bussiness. INHAPDIEM_SUB.HocSinhTheoLop(string malop)" + e.Message);
            }
            finally
            {
                idbManager.Dispose();
            }
            return dtb;
        }
    }
}
